package flexUnitTests
{
	import flashx.textLayout.debug.assert;
	
	import flexunit.framework.Assert;
	
	import mx.collections.ArrayCollection;
	import mx.effects.effectClasses.ZoomInstance;
	
	import org.flexunit.asserts.assertEquals;
	import org.flexunit.asserts.assertTrue;
	
	import vivek.project.pocketmoney.admin.model.AdminDataCache;
	import vivek.project.pocketmoney.admin.model.AdminDataModel;
	import vivek.project.pocketmoney.common.PocketMoneyInit;
	
	public class AdminTests
	{		
		[Before]
		public function setUp():void
		{
		}
		private var adminDataModel:AdminDataModel=AdminDataModel.getInstance();
		[After]
		public function tearDown():void
		{
		}
		static var  accountName:String = "Test Account";
		private static var accObjUser1:Object = new Object();
		private static var accObjUser2:Object = new Object();
		[BeforeClass]
		public static function setUpBeforeClass():void
		{
			new PocketMoneyInit();

			accObjUser1.accountName= accountName;
			accObjUser1.description="Account Testing purpose";
			accObjUser1.currency="1";
			accObjUser1.accountType="1";
			accObjUser1.color="111111";
			accObjUser1.minimum=0;
			
		
			accObjUser2.accountName= accountName;
			accObjUser2.description="Account Testing purpose";
			accObjUser2.currency="1";
			accObjUser2.accountType="1";
			accObjUser2.color="111111";
			accObjUser2.minimum=0;
			
		;

		}
		
		[AfterClass]
		public static function tearDownAfterClass():void
		{
		}
		
		[Test (order=10)]
		public function testAddCashAccountUser1():void
		{
			var id = adminDataModel.addAccount(accObjUser1);
			//var id:Number = adminDataModel.getAccountIdByName(accObj.accountName);
			var name:String = adminDataModel.getAccountNameForId(id);
			var account:Object = AdminDataModel.getAccountDetailsByName(name);	
			var cashAccounts:ArrayCollection=adminDataModel.getAccountsForType(1);
			//assertEquals("Check number of cash accounts",2,cashAccounts.length);
			Assert.assertEquals("Assert account name",name,accObjUser1.accountName);
			Assert.assertEquals("Assert account name",account.am_accountname,name);
		}
		[Test (order=11)]
		public function testAddCashAccountUser2():void
		{
			AdminDataCache.ACCOUNT_IN_USE=2;
			var id = adminDataModel.addAccount(accObjUser2);
			AdminDataCache.ACCOUNT_IN_USE=1;
			//var id:Number = adminDataModel.getAccountIdByName(accObj.accountName);
			var name:String = adminDataModel.getAccountNameForId(id);
			var account:Object = AdminDataModel.getAccountDetailsByName(name);	
			var cashAccounts:ArrayCollection=adminDataModel.getAccountsForType(1);
			//assertEquals("Check number of cash accounts",2,cashAccounts.length);
			Assert.assertTrue("Account exists ?",AdminDataCache.accountDataAll.contains(account));
			Assert.assertTrue("Visible to the selected user?",AdminDataCache.accountData.contains(account));
			Assert.assertTrue("Visible to the selected user?",AdminDataCache.cashAccounts.contains(account));
			Assert.assertTrue("Visible to the selected user?",AdminDataCache.cashAccountsAllUsers.contains(account));
		
		}
		[Test (order=15)]
		public function testValidCashAccountAfterAdd():void
		{
			
			var cashAccounts:ArrayCollection=adminDataModel.getAccountsForType(1);
			assertEquals("Check number of cash accounts",2,cashAccounts.length);
		}
		
		[Test]
		public function testAddChannel():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testAddCurrency():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testAddUser():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testAdminDataModel():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testBackupDatabase():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testDeleteAccount():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testGetAccount():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testGetAccountDetailsByName():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testGetAccountForId():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testGetAccountIdByName():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testGetAccountNameById():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testGetAccountNameForId():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testGetAccountsForType():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testGetAccountTypeId():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testGetChannelForId():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testGetCurrencyDetailsByName():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testGetCurrencyDetailsForAccount():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testGetCurrencyIdByName():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testGetDefaultUser():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testGetInstance():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testGetUserNameForId():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testSetDefaultUser():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testSetUser():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testSetUserID():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testTranferAccountOwnership():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testUpdateAccount():void
		{
			Assert.fail("Test method Not yet implemented");
		}
		
		[Test]
		public function testUpdateCurrency():void
		{
			Assert.fail("Test method Not yet implemented");
		}
	}
}